/*
ID: saboia
LANG: C++
TASK: test
*/
//...
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <map>
#include <iostream>
#include <list>
#include <deque>
#include <cstdio>
#include <cstring>
#include <cstdlib>
using namespace std;


int main (){
	//freopen(".in", "r", stdin);freopen(".out", "w", stdout);
	freopen("in.txt", "r", stdin);
	
	int n, c, i, j;
	int a[20000], b[20000], ac[10], bc[10];
	//bool ok[10];
	
	scanf("%d%d", &n, &a[0]);
	b[0]=0;
	for(i=1;i<n;++i){
		scanf("%d", &a[i]);
		b[i]=a[i]-a[i-1];
	}
	scanf("%d%d", &c, &ac[0]);
	bc[0]=0;
	for(i=1;i<c;++i){
		scanf("%d", &ac[i]);
		bc[i]=ac[i]-ac[i-1];
	}
	if(c==1){
		printf("%d\n", n);
		for(i=1;i<=n;++i)printf("%d\n", i);
	}
	else{
		for(i=0;i<n;++i){
			printf("%d %d\n", a[i], b[i]);
		}
		printf("\n");
		for(i=0;i<c;++i)
			printf("%d %d\n", ac[i], bc[i]);
		
	}
	return 0;
}
